package multithread.framework.threadpool;

import java.util.concurrent.Executor;
import java.util.concurrent.SynchronousQueue;
import java.util.concurrent.TimeUnit;

import multithread.framework.threadmethod.ThreadMethodContainer;

/**
 * 
 * ExecutorService Factory
 */
public class ExecutorServiceFactory {

	public static MethodExecutorService createMethodExecutorService() {
		MethodExecutorService methodService = new MethodExecutorService(0,
				Integer.MAX_VALUE, 0L, TimeUnit.SECONDS,
				new SynchronousQueue<Runnable>());
		return methodService;
	}

	public static MethodExecutorServiceProxy createMethodExecutorServiceProxy(
			ThreadMethodContainer threadMethodContainer, Object testCase) {
		MethodExecutorServiceProxy methodServiceProxy = new MethodExecutorServiceProxy(
				threadMethodContainer, testCase);
		return methodServiceProxy;
	}

	public static MethodCompletionService createMethodCompletionService(
			Executor executor, ThreadMethodContainer threadMethodContainer) {
		return new MethodCompletionService(executor,
				threadMethodContainer.getThreadMethodTimeout());
		// threadMethodContainer.getThreadMethodTimeout());
	}

}
